# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=EasyProcess
pkgname=python-${_pkg,,}
pkgver=1.1
pkgrel=2
pkgdesc="Easy to use python subprocess interface"
arch=(any)
url="https://github.com/ponty/EasyProcess"
license=(BSD)
depends=(python)
makedepends=(python-setuptools)
checkdepends=(python-pytest python-pytest-timeout python-entrypoint2
              python-pillow python-pyvirtualdisplay imagemagick iputils
              xorg-server-xvfb)
source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
sha256sums=('885898302a57aab948973e8b5d32a4229392b9fb2d986ab1d4ffd590e5ba90ec')

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

check() {
  cd ${_pkg}-${pkgver}
  # https://github.com/ponty/EasyProcess/issues/24
  PYTHONPATH="${PWD}"/build/lib/ pytest -vv --color=yes -k 'not test_deadlock_pipe'
  PYTHONPATH="${PWD}"/build/lib/ EASYPROCESS_USE_TEMP_FILES=0 pytest -vv --color=yes
}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  install -Dm644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}
}
